var siteGlobal = {
    SITE_HOST: 'http://wechatjh.fourjoy.net',
    APP_ID: 'wxa53d68910d74e151',
    WECHAT_DESCCONTENT: '想要在朋友圈、微信群中召集小伙伴一起聚会？点我立即实现',
    WECHAT_SHARETITLE: '发起聚会，和志同道合的人一醉方休',
    WECHAT_MSG_IMGURL: 'http://wechatjh.fourjoy.net/message_img.jpg'
}

$(function(){
    $('#sendBtn').on('click', function(){
        //意见反馈
        sentSuggest(function(){
            $('#suggestContent').val('');
            $('#suggest').modal('hide');
        })
    })
});
function sentSuggest(callback){
    var content = $('#suggestContent').val();
    $.post('/sentSuggest', {content: content}, function(res){
        AlertBox.showTip('多谢指教^_^');
        callback();
    })
}

$(function(){
    $('.toShare').live('click', function(e){
        scroll(0,0)
        Shade.open();
        $('.guide_share').show()
    });
    $('#closeGuide').on('click', function(){
        Shade.close();
        $('.guide_share').hide()
    })
})
Date.prototype.format = function(format){
    var o = {
        "Y"  : this.getFullYear(),
        "M+" : this.getMonth()+1, //month
        "d+" : this.getDate(), //day
        "h+" : this.getHours(), //hour
        "m+" : this.getMinutes(), //minute
        "s+" : this.getSeconds(), //second
        "q+" : Math.floor((this.getMonth()+3)/3), //quarter
        "S" : this.getMilliseconds() //millisecond
    }
    if(/(y+)/.test(format)) {
        format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
    }
    for(var k in o) {
        if(new RegExp("("+ k +")").test(format)) {
            format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
        }
    }
    return format;
}
Date.prototype.getZhDay = function(date){
    switch (date.getDay()){
        case 1 : return '一';
            break;
        case 2 : return '二';
            break;
        case 3 : return '三';
            break;
        case 4 : return '四';
            break;
        case 5 : return '五';
            break;
        case 6 : return '六';
            break;
        case 0 : return '日';
            break;
    }
}
function weixinShare() {
    var defaultData = {
        appId: 'wxa53d68910d74e151',
        img_url: 'http://wechatjh.fourjoy.net/message_img.jpg',
        img_width: '120',
        img_height: '120',
        callback: function (res) {
            //$('.mask-way').click();
        }
    };
    if(typeof shareData !== 'undefined'){
        $.extend(defaultData, shareData);
    }
    var onBridgeReady = function () {
        WeixinJSBridge.on('menu:share:appmessage', function (argv) {
            WeixinJSBridge.invoke('sendAppMessage', defaultData, function (res) {
                shareData.callback(res);
            });
        });
        WeixinJSBridge.on('menu:share:timeline', function (argv) {
            //var sharetimeData = timelineData || defaultData;
            WeixinJSBridge.invoke('shareTimeline', defaultData, function (res) {
                shareData.callback(res);
            });
        });
    }
    if (document.addEventListener) {
        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
    } else if (document.attachEvent) {
        document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
    }
}